<?php

class Conexao{
	
	public static function Conect($opitions =array()){
		if(empty($opitions)){
			$opitions = include DIRROOT.'/con.php'; 
			if(empty($opitions)){
				die("ERROR: not conect");
			}
		}
		try {
			$conn = new PDO('mysql:host='.$opitions["host"].';dbname='.$opitions["dbname"], $opitions["user"], $opitions["pas"]);
			$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
			return $conn;
		} catch(PDOException $e) {
			echo 'ERROR: ' . $e->getMessage();
		}
		
		
	}
}